app.controller('GetOneelectricdataCtrl',function ($scope,$http,$localStorage,$location,$window,$state) {
	$scope.namedata = $localStorage.cur_user.uname;		 
    $http.post(
        $scope.app.backendurl+"tbl-electricity-manage/view-one",
        {    
            
            'room_id':$state.params.roomid,
            'token':$localStorage.token                  

        }
      ).success(function (data) {
        //console.log(data);
        if(data.code==0&&data.msg=="读取成功"){             
          $scope.aaData = data.data.model;                
        }
        if(data.code==1){             
          alert(data.msg)
                
        }
        if(data.code==20001&&data.msg=='请先登录'){
          $location.path('access.signin');
        }  
    
   
    }).error(function(data){
      console.log(data);
    })

    $scope.recover = function(layer_id,room_id){
        $http.post(
            $scope.app.backendurl+"tbl-electricity-manage/manual-one-recover",
            {    
               'layer_id': layer_id,
               'room_id': room_id,
               'token':$localStorage.token                  

            }
          ).success(function (data) {
            //console.log(data);
            if(data.code==0){             
              alert(data.msg);                
            }
            if(data.code==1){             
              alert(data.msg)
                    
            }
            if(data.code==20001&&data.msg=='请先登录'){
              $location.path('access.signin');
            }  
        
       
        }).error(function(data){
          console.log(data);
        })
    }
     $scope.force = function(layer_id,room_id){
        $http.post(
            $scope.app.backendurl+"tbl-electricity-manage/force-one-cut-out",
            {    
               'layer_id':  layer_id,
               'room_id': room_id,
               'token':$localStorage.token                  

            }
          ).success(function (data) {
            // console.log(data);
            if(data.code==0){             
              alert(data.msg);                
            }
            if(data.code==1){             
              alert(data.msg)
                    
            }
            if(data.code==20001&&data.msg=='请先登录'){
              $location.path('access.signin');
            }  
        
       
        }).error(function(data){
          console.log(data);
        })
    }
	


	

})